<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<%
	String basepath = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html style="overflow-y: scroll;">
<head>
<title>煤矿企业安全生产许可证综合管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="icon" href="<%=basepath%>styles/images/favicon.ico"type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/styles/base.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/styles/default/index.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/themes/default/icon.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/themes/default/button.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/themes/default/panel.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/themes/default/tabs.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/themes/default/pagination.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/themes/default/validatebox.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/themes/default/grid.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/themes/default/tree.css">
<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/themes/default/form.css">

<link rel="stylesheet" type="text/css" href="<%=basepath%>/resources/plugins/upload/style/upload.css"></link>
<script type="text/javascript">var basepath="<%=basepath%>"</script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/jquery.js"></script>

<script type="text/javascript" src="<%=basepath%>/resources/plugins/dialog/jquery.dialog.js?skin=orange"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/jquery.loader.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.parser.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.resizable.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.draggable.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.button.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.panel.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.tabs.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.pagination.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.validatebox.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.grid.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.tree.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/scripts/jquery.form.js"></script>

<script type="text/javascript" src="<%=basepath%>/resources/plugins/datepicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/upload/swfobject.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/plugins/upload/jquery.upload.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/scripts/CoreConstant.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/scripts/CoreUtil.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/scripts/CoreCheck.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/scripts/CoreModule.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/scripts/CoreSimpleModule.js"></script>
<script type="text/javascript" src="<%=basepath%>/resources/scripts/CoreApplication.js"></script>
<style>
.tree-node-selected{background:#e1e1e1;}
</style>
<script type="text/javascript">
$(function(){
	
	app.instance().activeMenu($($(".sys li").get(0)).attr("module"),null);
	
	$("#quit").unbind("click").bind("click",function(){
		
		if(!$("#save").is(":visible"))  {
			
			backSystem(); 
			
			return true;
			
		}
		
		var is = confirm("系统中有数据未保存，您确定退出系统吗？确认：继续编辑。取消：重新登录。");
		
		if(is){
			
			return false;
			
		}else{
			
			window.location.href=basepath+"/login";
			
		};
		
	});
	
	var backSystem= function(){
		
		$.dialog({
			
			title: "消息提醒",
			
	        id: 'Confirm',
	        
	        icon: 'question',
	        
	        fixed: true,
	        
	        lock: true,
	        
	        opacity: .1,
	        
	        content: "您确定要退出本系统吗？",
	        
	        button: [
                 {
                     name: '直接退出',
                     
                     callback: function () {
                    	 
                    	window.opener=null;
      		           
         		        window.open('','_self');
         		        	
         		        window.close();
                     },
                     
                     focus: true
                 },
                 {
                     name: '重新登录',
                     
                     callback: function () {
                    	 
                    	 window.location.href=basepath+"/login";
                     }
                 }
             ]
	    });
		
	};
	
	$("#upUserPw").unbind("click").bind("click", function() {
		
		var params= util.getParams();
		
		var CURR_PASSWORD=$("input[name='CURR_PASSWORD']" ,"form[name='UserFrom']").val();
		
		var OLD_PASSWORD=$("input[name='OLD_PASSWORD']" ,"form[name='UserFrom']").val();
		
		var NEW_PASSWORD=$("input[name='NEW_PASSWORD']" ,"form[name='UserFrom']").val();
		
		var CONFIRM_PASSWORD=$("input[name='CONFIRM_PASSWORD']" ,"form[name='UserFrom']").val();
		
		params.USER_PASSWORD = NEW_PASSWORD;
		
		params.USER_ID = $("#app_body").attr("uid");
		
		if($.trim(OLD_PASSWORD)==""){
			
			$("#msg").html("操作提示：原始密码不能为空！");
			
			return false;
			
		}
		
		if($.trim(NEW_PASSWORD)==""){
			
			$("#msg").html("操作提示：新密码不能为空！");
			
			return false;
			
		}
		
		if($.trim(CONFIRM_PASSWORD)==""){
			
			$("#msg").html("操作提示：确认密码不能为空！");
			
			return false;
			
		}
			
		if($.trim(OLD_PASSWORD) != CURR_PASSWORD){
			
			$("#msg").html("操作提示：原始密码不正确！");
			
			return false;
			
		}
		
		if($.trim(NEW_PASSWORD) != $.trim(CONFIRM_PASSWORD)){
			
			$("#msg").html("操作提示：新密码和确认密码不相同！");
			
			return false;
			
		}
				
		$.post(basepath+"/admin/user/save",params,function(data){
			
			if(data.success){
				
				window.location.href=basepath+"/login";
				
			}else{
				
				$("#msg").html("操作提示：修改失败！");
				
			}
			
		},"json");
		
	});
	
	$(".userhead img").toggle(
		
		function(){
			
			$(".userInfo").show();
			
			$("#userTx").attr("title","点击我能关闭修改密码框哦-_-!");
		
		},function(){
		
			$(".userInfo").hide();
			
			$("#userTx").attr("title","点击我能打开修改密码框哦-_-!");
			
	});
	
	$(".show_pwd").unbind("click").bind("click",function(){
		
		var oldPw = $("input[name='OLD_PASSWORD']","form[name='UserFrom']").val();
		
		var newPw = $("input[name='NEW_PASSWORD']","form[name='UserFrom']").val();
		
		var confirmPw = $("input[name='CONFIRM_PASSWORD']","form[name='UserFrom']").val();

		if($(this).attr("checked") == "checked") {

			$("#oldPw").html('<input name="OLD_PASSWORD" type="text" value="'+oldPw+'">');
			
			$("#newPw").html('<input name="NEW_PASSWORD" type="text" value="'+newPw+'">');
			
			$("#confirmPw").html('<input name="CONFIRM_PASSWORD" type="text" value="'+confirmPw+'">');
			
		}else {

			$("#oldPw").html('<input name="OLD_PASSWORD" type="password" value="'+oldPw+'">');
			
			$("#newPw").html('<input name="NEW_PASSWORD" type="password" value="'+newPw+'">');
			
			$("#confirmPw").html('<input name="CONFIRM_PASSWORD" type="password" value="'+confirmPw+'">');
			
		}
		
	});
	
	app.reloadWorkinfo();
});
</script>
</head>
<body id="app_body" uid="${user.USER_ID}">

	 <div id="top">
			<div class="header">
				<div class="fl">
					<img src="<%=basepath%>/resources/styles/default/images/index/logo_${params.utype }.jpg"/>
				</div>
			</div>
			<div class="nav">
				<ul class="sys">
					<c:forEach items="${modules }" var="module">
				    	<c:if test="${module.MODULE_TYPE =='M-S' }">
						    <li module="${module.MODULE_NO }" namespace="${module.MODULE_NAMESPACE }">
						    	<a href="javascript:void(0);">${module.MODULE_NAME }</a><b></b>
							</li>
						</c:if>
				    </c:forEach>
				</ul>
				<div id="quit" class="quit fr">
					<span><a  loginType="${params.USER_TYPE }" href="javascript:void(0);" >注销</a></span>
				</div>
			</div>
		</div>
		<div id="contet" >
		    <div class="user border">
				<div class="userhead fl" style="padding:1px;">
					<img id="userTx" src="<%=basepath %>/resources/styles/default/images/index/tx01.jpg" title="点击我能打开修改密码框哦-_-!"/>
					<div class="userInfo" style="padding:2px; display:none;"><b></b>	
						<form name="UserFrom" class="core-form" col="4" type="item">		
							<input type="hidden" name="CURR_PASSWORD" value="${user.USER_PASSWORD }"/>
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td>原始密码：</td>
									<td><span id="oldPw"><input name="OLD_PASSWORD" type="text"></span></td>
								</tr>
								<tr>
									<td>新&nbsp;密&nbsp;码：</td>
									<td><span id="newPw"><input name="NEW_PASSWORD" type="text"></span></td>
								</tr>
								<tr>
									<td>确认密码：</td>
									<td ><span id="confirmPw"><input name="CONFIRM_PASSWORD" type="text"></span></td>
								</tr>
								<tr>
									<td>显示字符：</td>
									<td><input class="show_pwd" name="view_pwd" type="checkbox" style="border:0px;margin-bottom:-5px;" checked="checked"></td>
								</tr>	
							  <tr>
							    <td colspan="2"><div style="text-align: center;"><a id="upUserPw" class="core-button form-button" icon="icon-save">修改</a></div></td>
							  </tr>
							  <tr>
							  	<td colspan="2"><div style="text-align: center;"><span id="msg" style="color: red;">&nbsp;</span></div></td>
							  </tr>
							</table>
						</form>
					</div>
				</div>
				<div class="userabout fl" style="line-height:18px;">
					机构：<span>${user.ORGAN_NAME == null ? "系统管理员" : user.ORGAN_NAME}</span>
					<br/>角色：<span>${user.ROLE_NAME == null ? "管理员" : user.ROLE_NAME}</span>
					<br/>用户：<span id="userInfo" curr_user="${user.USER_ID }" curr_organ="${user.ORGAN_ID}" curr_organType="${user.ORGAN_TYPE }">${user.USER_NAME}</span>
				</div>
				<div class="tip fr" id="wkinfo" style="line-height:60px; font-size:20px; font-weight:bold;">

				</div>
			</div>
			<div class="blank5"></div>
			<div id="app_main"></div>
		</div>

		<div id="popWin" style="display: none;"></div>
		<!--页脚footer-->
		<div id="footer">
			
		</div>
	</div>